home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 17
/
CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso
/
CUCD
/
Programming
/
DiceSource
/
suplib
/
strnicmp.c
< prev
Wrap
C/C++ Source or Header
|
1995-09-23
|
534b
|
41 lines
/*
* STRNICMP.C
*
* (C)Copyright 1990, Matthew Dillon, All Rights Reserved
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#ifndef HYPER
#define HYPER(x) x
#endif
typedef unsigned char ubyte;
int
HYPER(strnicmp)(s, d, n)
const char *s;
const char *d;
int n;
{
ubyte c;
if (n == 0)
return(0);
while (tolower(c = *s) == tolower(*(ubyte *)d)) {
if (c == 0 || --n == 0)
return(0);
++s;
++d;
}
if (tolower(c) < tolower(*(ubyte *)d))
return(-1);
return(1);
}